//
// Created by lwj12 on 24-9-3.
//

#ifndef RBTREE_MYSET_H
#define RBTREE_MYSET_H
#include "RBTree.h"

namespace lwj
{
    template<class K>
    class MySet
    {
    public:
        struct KOfSet
        {
            K operator()(const K& key) {return key;}
        };

        typedef typename RBTree<K, K, KOfSet>::iterator iterator;
        typedef typename RBTree<K, K, KOfSet>::const_iterator const_iterator;

        iterator begin() {return rbt.begin();}
        iterator end() {return rbt.end();}
        const_iterator begin() const {return rbt.begin();}
        const_iterator end() const {return rbt.end();}

        pair<iterator, bool> insert(const K& val) {return rbt.insert(val);}
        pair<iterator, bool> find(const K& val) {return rbt.find(val);}
        void InOrder() {rbt.InOrder();}

    private:
        RBTree<K, K, KOfSet> rbt;
    };
}

#endif//RBTREE_MYSET_H
